import java.sql.*;


public class Schreiben {
public static void main(String[] argv) {
		
		
		System.out.println("-------- PostgreSQL "
				+ "JDBC Connection Testing ------------");
 
		try { // Initialisierung Treiber
 
			Class.forName("org.postgresql.Driver");
			
 
		} catch (ClassNotFoundException e) {
 
			System.out.println("Where is your PostgreSQL JDBC Driver? "
					+ "Include in your library path!");
			e.printStackTrace();
			return;
 
		}
 
		System.out.println("PostgreSQL JDBC Driver Registered!");
 
		Connection connection = null;
		
		
		try { // Verbindungsaufbau zu Datenbank
 
			connection = DriverManager.getConnection(
					"jdbc:postgresql://localhost:5432/CATDAT", "postgres",
					"dast");
			
			Statement statement = connection.createStatement();
			String updateString = "UPDATE iket.event_earthquake SET depth='17' WHERE depth LIKE '16'";
			statement.executeUpdate(updateString);	
						
														
							
				connection.close();
				
				
		} catch (SQLException e) {
 
			System.out.println("Connection Failed! Check output console");
			e.printStackTrace();
			return;
			
			
		}
	
		
		if (connection != null) {
			System.out.println("You made it, take control your database now!");
			
			
		} 
		else {
			System.out.println("Failed to make connection!");
		}
	}
}
